class CreatePages < ActiveRecord::Migration[5.0]
  def change
    create_table :pages do |t|
      t.string     :slug
      t.index      :slug

      t.string     :title
      t.string     :description
      t.string     :author
      t.text       :content

      t.integer    :category_id
      t.index      :category_id

      t.integer    :position, default: 0
      t.index      :position

      t.string     :page_type, default: :normal
      t.integer    :forwarding_page_id
      t.integer    :forwarding_category_id
      t.string     :forwarding_url

      t.attachment :avatar
      t.text       :metadata

      # Analytics
      t.integer    :view_count

      t.timestamps
    end
  end
end
